<template>
  <div class="container-content">
    <el-row>
      <el-col :span="24">
        <h3 class="panel-title">编辑收款</h3>
      </el-col>
    </el-row>
    <el-form
      ref="formRef"
      :model="formObject"
      label-width="100px"
      label-position="left"
    >
      <el-card shadow="never">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="客户Id">
              <el-input v-model="formObject.customerId"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同Id">
              <el-input v-model="formObject.contractId"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="更新时间">
              <el-date-picker
                v-model="formObject.changeTime"
                type="date"
                placeholder="选择日期"
                style="width: 100%"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="创建时间">
              <el-date-picker
                v-model="formObject.createTime"
                type="date"
                placeholder="选择日期"
                style="width: 100%"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="回款责任人">
              <el-input v-model="formObject.collectUserId"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注">
              <el-input v-model="formObject.remarks" type="textarea"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-form-item label-width="0px" style="margin-top: 20px">
        <el-button type="primary" @click="onSubmit">保存</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { getDetailCollect, editCollectList } from "@/api/system/contract";
export default {
  data() {
    return {
      formObject: {
        changeTime: "",
        collectUserId: "",
        contractId: "",
        createTime: "",
        customerId: "",

        limit: 0,
        page: 0,
        remarks: "",
        token: "",
      },
    };
  },
  methods: {
    onSubmit() {
      editCollectList(this.formObject).then((res) => {
        if (res.code === 200) {
          this.$message({
            message: "修改成功！",
            type: "success",
          });
          this.$router.push({ path: "/Contract/Plan" });
        }
      });
    },
    getData(id) {
      getDetailCollect(id).then((res) => {
        this.formObject = res.data;
      });
    },
  },
  created() {
    this.getData(this.$route.query.id);
  },
};
</script>
<style lang="scss" scoped></style>
